☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

pull_request_templates[*]

Table of contents

Description:

This key represents an individual pull request template object in the pull_request_templates array.

The value is an object that defines a template for pull requests. Each template can contain label, title, body, template_path, and _inputs keys.

Appears in:
└── pull_request_templates
    └── [*]
Type:
Object
Properties:
bodystring#

This key defines the default value of the "Body" field in your Pull Request.

This key has no default.

Show examplesHide examples

In this example, the body field of our Pull Request template is populated by the string "In this update, I have made the following changes..." by default.

Copied to clipboard
pull_request_templates:
  - label: Content Update
    title: Updates to...
    body: In this update, I have made the following changes...
{
  "pull_request_templates": [
    {
      "label": "Content Update",
      "title": "Updates to...",
      "body": "In this update, I have made the following changes..."
    }
  ]
}

This key defines which inputs are available at a given level of the configuration cascade.

This key has no default.

If undefined at higher levels of the configuration cascade, _inputs will default to any values configured in the CloudCannon configuration file.

Show examplesHide examples

In this example, we have configured the date_created key as a Date and Time Input, which will automatically populate when you create a file using this input. Editors cannot alter this input as the interface is disabled.

Copied to clipboard
_inputs:
  date_created:
    type: datetime
    label: Date of article creation
    comment: UTC +0 timezone
    context:
      open: false
      title: Help
      icon: help
      content: This date field will automatically populate when you create an article.
    hidden: false
    disabled: true
    instance_value: NOW
    cascade: true
    options:
      timezone: Etc/UTC
{
  "_inputs": {
    "date_created": {
      "type": "datetime",
      "label": "Date of article creation",
      "comment": "UTC +0 timezone",
      "context": {
        "open": false,
        "title": "Help",
        "icon": "help",
        "content": "This date field will automatically populate when you create an article."
      },
      "hidden": false,
      "disabled": true,
      "instance_value": "NOW",
      "cascade": true,
      "options": {
        "timezone": "Etc/UTC"
      }
    }
  }
}

In this example, we have configured the blog_tags key as a Multiselect Input in the blog Collection.

Copied to clipboard
collections_config:
  blog:
    _inputs:
      blog_tags:
        type: multiselect
        label: Blog type
        comment: Select a blog type
        context:
          open: false
          title: Help
          icon: help
          content: |
            Blog tags help our users filter articles by topic.
        options:
          values:
            - Opinion
            - Feature
            - Resource
{
  "collections_config": {
    "blog": {
      "_inputs": {
        "blog_tags": {
          "type": "multiselect",
          "label": "Blog type",
          "comment": "Select a blog type",
          "context": {
            "open": false,
            "title": "Help",
            "icon": "help",
            "content": "Blog tags help our users filter articles by topic.\n"
          },
          "options": {
            "values": [
              "Opinion",
              "Feature",
              "Resource"
            ]
          }
        }
      }
    }
  }
}
labelstring#

This key defines the name of a Pull Request template, which appears in the dropdown menu on the Publishing page.

This key has no default.

Show examplesHide examples

In this example, the name of the Pull Request template in the dropdown menu on the Publishing page will be "Content Update".

Copied to clipboard
pull_request_templates:
  - label: Content Update
    title: Updates to...
    body: In this update, I have made the following changes...
{
  "pull_request_templates": [
    {
      "label": "Content Update",
      "title": "Updates to...",
      "body": "In this update, I have made the following changes..."
    }
  ]
}

This key defines the path to the file CloudCannon should use as the value of the body field in a Pull Request template. This file path must be relative to the root of your repository (i.e., /, not the value of source). This allows you to create more complex default content for your Pull Request.

CloudCannon will not use the content of this file if the body key is also defined for the Pull Request template.

This key has no default.

Show examplesHide examples

In this example, the body field of our Pull Request template is populated by the contents of .github/templates/delete-content.md by default.

Copied to clipboard
pull_request_templates:
  - label: Delete content
    title: Delete content
    _inputs:
      title:
        options:
          disabled: true
    template_path: .github/templates/delete-content.md
{
  "pull_request_templates": [
    {
      "label": "Delete content",
      "title": "Delete content",
      "_inputs": {
        "title": {
          "options": {
            "disabled": true
          }
        }
      },
      "template_path": ".github/templates/delete-content.md"
    }
  ]
}
titlestring#

This key defines the default value of the "Title" field in your Pull Request.

This key has no default.

Show examplesHide examples

In this example, the title field of our Pull Request template is populated by the string "Updates to..." by default.

Copied to clipboard
pull_request_templates:
  - label: Content Update
    title: Updates to...
    body: In this update, I have made the following changes...
{
  "pull_request_templates": [
    {
      "label": "Content Update",
      "title": "Updates to...",
      "body": "In this update, I have made the following changes..."
    }
  ]
}
Examples:

In this example, we have configured a Pull Request template with a label, title, body, and input configuration.

Copied to clipboard
pull_request_templates:
  - label: General changes
    title: Updates to...
    body: In this update, I have made the following changes...
    _inputs:
      title:
        options:
          required: true
      body:
        type: markdown
        options:
          bold: true
          italic: true
          link: true
          format: p h1 h2 h3
{
  "pull_request_templates": [
    {
      "label": "General changes",
      "title": "Updates to...",
      "body": "In this update, I have made the following changes...",
      "_inputs": {
        "title": {
          "options": {
            "required": true
          }
        },
        "body": {
          "type": "markdown",
          "options": {
            "bold": true,
            "italic": true,
            "link": true,
            "format": "p h1 h2 h3"
          }
        }
      }
    }
  ]
}
Open in a new tab